#include "crab_base.h"
#include "base/lang/ByteOrder.h"

CRAB_LANG_BEGIN_NAMESPACE()

const int ByteOrder::LITTLE_BIG = 1;
const int ByteOrder::BIG_LITTLE = 2;

int ByteOrder::systemByteOrder(){
	static ByteOrder o ;
	return o.m_order;
}

ByteOrder::ByteOrder()
{
	union {
		char ch[4];
		int  ii;
	} uu;
	
	uu.ii = 1;
	m_order = (uu.ch[0] == 1) ? BIG_LITTLE : LITTLE_BIG;
}

CRAB_LANG_END_NAMESPACE()
